wayland/popup: Use maybe_notify_mapped() helper
authorJonas Ådahl <jadahl@gmail.com>
Thu, 19 Nov 2020 09:43:22 +0000 (10:43 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Mon, 7 Dec 2020 08:46:38 +0000 (09:46 +0100)
gdk/wayland/gdksurface-wayland.c

index 2f227dcd3f92d9e0bc81e7e4403bb3228ebb3666..c992ff4214146ce99349f177d93cd72dd2b7ebb0 100644 (file)
@@ -2948,6 +2948,19 @@ is_relayout_finished (GdkSurface *surface)
   return TRUE;
 }
 
+static void
+maybe_notify_mapped (GdkSurface *surface)
+{
+  if (surface->destroyed)
+    return;
+
+  if (!GDK_SURFACE_IS_MAPPED (surface))
+    {
+      gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_WITHDRAWN, 0);
+      gdk_surface_invalidate_rect (surface, NULL);
+    }
+}
+
 static void
 gdk_wayland_surface_map_popup (GdkSurface     *surface,
                                int             width,
@@ -2983,7 +2996,7 @@ gdk_wayland_surface_map_popup (GdkSurface     *surface,
   impl->popup.unconstrained_height = height;
   impl->mapped = TRUE;
 
-  gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_WITHDRAWN, 0);
+  maybe_notify_mapped (surface);
 }
 
 static void
@@ -4736,19 +4749,6 @@ gdk_wayland_toplevel_class_init (GdkWaylandToplevelClass *class)
   gdk_toplevel_install_properties (object_class, 1);
 }
 
-static void
-maybe_notify_mapped (GdkSurface *surface)
-{
-  if (surface->destroyed)
-    return;
-
-  if (!GDK_SURFACE_IS_MAPPED (surface))
-    {
-      gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_WITHDRAWN, 0);
-      gdk_surface_invalidate_rect (surface, NULL);
-    }
-}
-
 static void
 reconfigure_callback (void               *data,
                       struct wl_callback *callback,